package com.datatest.config;

import feign.Logger;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author lxt
 * Created by Jccfc on 2021/10/21.
 * feign配置类
 */
@Configuration
public class FeignConfig extends RestTemplateInterceptor {
    @Bean
    SpringFormEncoder feignFormEncoder(ObjectFactory<HttpMessageConverters> converters) {
        return new SpringFormEncoder(new SpringEncoder(converters));
    }

    @Bean
    //为feign请求添加日志
    public Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }
}
